package com.woniuxy02;

import java.util.*;

/**
 * @author 作者
 * @create 2025-06-09 14:08
 */
public class Test04 {
    //ArrayList嵌套Map
    public static void main(String[] args) {
        List<Student> list = new ArrayList<Student>();
        list.add(new Student("1","zs",15));
        list.add(new Student("2","ls",19));
        list.add(new Student("3","ww",11));
        System.out.println("排序前："+list);
        Collections.sort(list);
        System.out.println("排序后："+list);
        Collections.sort(list, new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o2.getAge()-o1.getAge();
            }
        });
        System.out.println("排序后："+list);

    }
}
